import { useSelector, useDispatch } from 'react-redux'
import { setCount, Store } from "@/store"
// import { Store } from "@/store";
import classNames from 'classnames';
import INDEX from "@/styles/index.module.css"

function User() {
  const count = useSelector<Store, number>(state => state.user.count)
  const dispatch = useDispatch()
  
  const handleClick = () => {
    console.log("handleClick")
    dispatch(setCount(count + 1))
  }
//   创建动态class名---动态修改类名
  const klass = classNames({
    [INDEX.wrapper]: true
  })

  return (
    <>
        <div onClick={handleClick} className={INDEX.wrapper + " " + klass}>
            hello world{count}
        </div>
    </>
  )
}

export default User
